1. Field of the Invention
This invention relates to a method and apparatus for compressing and expanding digital image data, and especially relates to image compression by reducing the number of pixels of original image data, and image expansion by increasing the number of pixels of reduced-image data.
2. Description of the Related Art
In an example of an image compression method, it has been known to calculate the average value of a predetermined number of pixels. In this compression method, applied to original digital image data, which is partitioned into pixel-blocks composed of a plurality of pixels, an average pixel value for the plurality of pixels is calculated in each block. Consequently, reduced-image data composed of pixels having the average pixel values is obtained. When expanding the reduced-image data to restore the original image, an interpolation processing, such as a linear interpolation, is usually performed so that expanded-image data corresponding to the original image data is obtained.
However, since part of the information included in the original image data is lost in the process of generating the reduced-image data, pixel values generated by the interpolation processing are not necessarily equal to corresponding pixel values in the original image data. Namely, the expanded-image data does not coincide with the original image-data. Therefore, picture quality decreases in the process of the compression and expansion processing, and the original image data can not be completely restored.
Therefore, an object of the present invention is to provide a method and apparatus for compressing and expanding digital image data efficiently, while limiting degradation in picture quality.
The compression apparatus according to the present invention has a reduced-image generating processor, a fluency transform processor, a differential value calculating processor, an orthogonal transform processor, a mode setting processor, a code-length calculating processor, an optimum mode determining processor and an optimum Entropy coding processor. The reduced-image generating processor transforms original imaged at a partitioned into first blocks, each of which is composed of a plurality of pixels, to reduced-image data composed of a smaller number of pixels than that of the original image data. The fluency transform processor applies a fluency transform to the reduced-image data so as to generate expanded-image data partitioned into second blocks corresponding to the first blocks. Note that, the fluency transform has a plurality of modes. The differential value calculating processor obtains differential value data indicating a difference between the original image data and the expanded-image data. The orthogonal transform processor obtains orthogonal transform coefficient data by applying an orthogonal transform to the differential value data. The mode setting processor selects one mode from the plurality of modes. Thus, the orthogonal transform coefficient data is generated in accordance with the selected mode. The code-length calculating processor calculates a code-length corresponding to a bit length of an Entropy-encoded bit data obtained by Entropy coding of the orthogonal transform coefficient data. The code-length calculating processor calculates the code-length in each of the plurality of modes. The optimum mode determining processor determines an optimum mode, by which the code-length becomes minimum, from the plurality of modes. The optimum Entropy coding processor obtains Entropy-encoded bit data by applying the Entropy coding to the orthogonal transform coefficient data in accordance with the optimum mode. Preferably, the compression apparatus has a recording medium for recording the reduced-image data, the optimum mode and the Entropy-encoded bit data.
On the other hand, an expansion apparatus according to the present invention has a data reading processor, an optimum mode setting processor, an expanded-image generating processor, an Entropy decoding processor, an inverse orthogonal transform processor and an original image data restoring processor. The data reading processor reads the reduced-image data, the Entropy-encoded bit data and the optimum mode recorded in the recording medium. The optimum mode setting processor sets the optimum mode from the plurality of modes.
The expanded-image generating processor applies the fluency transform according to the optimum mode to the reduced-image data so that the expanded-image data is obtained. The Entropy decoding processor that restores the orthogonal transform coefficient data by applying Entropy-decoding to the Entropy-encoded bit data. The inverse orthogonal transform processor restores the differential value data by applying an inverse orthogonal transform to the orthogonal transform coefficient data. The original image data restoring processor restores the original image data on the basis of the expanded-image data and the differential value data.